<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.20"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libxlsxwriter: Running the Test Suite</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">libxlsxwriter
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.20 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="PageDoc"><div class="header">
  <div class="headertitle">
<div class="title">Running the Test Suite </div>  </div>
</div><!--header-->
<div class="contents">
<div class="toc"><h3>Table of Contents</h3>
<ul><li class="level1"><a href="#tests_functional">Functional Tests</a></li>
<li class="level1"><a href="#tests_">Unit Tests</a></li>
<li class="level1"><a href="#tests_valgrind">Valgrind Tests</a></li>
<li class="level1"><a href="#tests_travis">Travis Continuous Integration</a></li>
</ul>
</div>
<div class="textblock"><p>This section shows how to set up and run the test suite for libxlsxwriter.</p>
<h1><a class="anchor" id="tests_functional"></a>
Functional Tests</h1>
<p>The functional tests compare the output from libxlsxwriter against xlsx files created in Excel.</p>
<p>The functional tests use the Python module <a href="http://pytest.org/">pytest</a> as a test runner.</p>
<p>Install the <code>pytest</code> module using one of the following methods: </p><pre class="fragment">sudo apt-get install -y python-pytest
# or
sudo easy_install pytest
# or
sudo pip install pytest
</pre><p>The functional tests can then be run: </p><pre class="fragment">$ cd libxlsxwriter

$ make test_functional

=========================== test session starts ===========================
collected 14 items

test/functional/test_formatting.py:16: TestCompareXLSXFiles.test_format01 PASSED
test/functional/test_formatting.py:19: TestCompareXLSXFiles.test_format02 PASSED
test/functional/test_formatting.py:24: TestCompareXLSXFiles.test_format06 PASSED
...
test/functional/test_write_data.py:25: TestCompareXLSXFiles.test_data04 PASSED
test/functional/test_write_data.py:28: TestCompareXLSXFiles.test_data05 PASSED
test/functional/test_write_data.py:31: TestCompareXLSXFiles.test_data06 PASSED
test/functional/test_write_data.py:34: TestCompareXLSXFiles.test_data07 PASSED
=========================== 14 passed in 0.41 seconds =====================
</pre><h1><a class="anchor" id="tests_"></a>
Unit Tests</h1>
<p>The unit tests test the components of the library at the level of individual functions or compilation units.</p>
<p>The unit tests uses the <a href="http://github.com/bvdberg/ctest">ctest</a> test framework. This is included as a header file in the <code>test/unit</code> directory and doesn't need to be installed.</p>
<p>The unit tests can then be run as follows: </p><pre class="fragment">$ make test_unit
Compiling unit tests ...
TEST 1/155 utility:_datetime_date_and_time [OK]
TEST 2/155 utility:_datetime_date_only [OK]
TEST 3/155 utility:_datetime_date_only_1904 [OK]
TEST 4/155 utility:_datetime_time_only [OK]
...
TEST 152/155 styles:write_xf34 [OK]
TEST 153/155 styles:write_xf35 [OK]
TEST 154/155 styles:write_xf36 [OK]
TEST 155/155 styles:xml_declaration [OK]

RESULTS: 155 tests (155 ok, 0 failed, 0 skipped) ran in 42 ms
</pre><p>Both functional and unit test can be run together: </p><pre class="fragment">$ make test
</pre><h1><a class="anchor" id="tests_valgrind"></a>
Valgrind Tests</h1>
<p>The functional tests and examples can be run under <a href="http://valgrind.org">Valgrind</a> to verify that there are no memory leaks.</p>
<p>Install <code>valgrind</code> as follows: </p><pre class="fragment">apt-get install -y valgrind
</pre><p>Then run the tests: </p><pre class="fragment">make test_valgrind
</pre><h1><a class="anchor" id="tests_travis"></a>
Travis Continuous Integration</h1>
<p>Libxlsxwriter is configured to run all tests in <a href="https://travis-ci.org/jmcnamara/libxlsxwriter">Travis Continuous Integration</a> for each commit.</p>
<p>Next: <a class="el" href="faq.html">Frequently Asked Questions</a> </p>
</div></div><!-- contents -->
</div><!-- PageDoc -->
<!-- HTML footer for doxygen 1.8.20-->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Copyright 2014-2020 John McNamara.
Generated by&#160;<a href="http://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.8.20
</small></address>
</body>
</html>
